package com.tyk.bookstore.back.order.util;


import com.tyk.bookstore.back.logistics.model.query.WayBill4OrderAddQuery;
import com.tyk.bookstore.back.order.manager.excel.model.OrderExcelVo;
import com.tyk.bookstore.back.order.model.dto.OrderCneeAddressDto;
import com.tyk.bookstore.back.order.model.dto.OrderExplicitDto;
import com.tyk.bookstore.back.order.model.entity.OrderDetailDo;
import com.tyk.bookstore.back.order.model.entity.OrderDo;
import com.tyk.bookstore.back.order.model.entity.OrderExtraDo;
import com.tyk.bookstore.back.order.model.query.CneeAddressUpdateQuery;
import com.tyk.bookstore.back.order.model.query.OrderDispatchQuery;
import com.tyk.bookstore.back.order.model.vo.OrderCneeAddressVo;
import com.tyk.bookstore.back.order.model.vo.OrderPageVo;
import com.tyk.bookstore.back.order.model.vo.OrderVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface MapStructOrder {
    List<OrderVo.OrderDetail> toOrderVo$OrderDetailList(List<OrderDetailDo> orderDetailDoList);


    OrderExtraDo toOrderExtraDo(CneeAddressUpdateQuery query);

    OrderCneeAddressVo toOrderCneeAddressVo(OrderCneeAddressDto dto);

    @Mappings({
            @Mapping(target = "id", source = "oc.id"),
            @Mapping(target = "orderNo", source = "oc.orderNo"),
            @Mapping(target = "warehouseId", source = "oc.warehouseId"),
            @Mapping(target = "amount", source = "oc.amount"),
            @Mapping(target = "state", source = "oc.state"),
            @Mapping(target = "createTime", source = "oc.createTime"),
            @Mapping(target = "cneeName", source = "oe.cneeName"),
            @Mapping(target = "paymentWay", source = "oe.paymentWay"),
    })
    OrderPageVo.Order toOrderPageVo$Order(OrderExplicitDto oc, OrderExplicitDto oe);

    @Mappings({
            @Mapping(target = "orderId", source = "q.orderId"),
            @Mapping(target = "orderCreateTime", source = "o.createTime"),
    })
    WayBill4OrderAddQuery toWayBill4OrderAddQuery(OrderDispatchQuery q, OrderDo o, OrderCneeAddressDto a);

    OrderVo toOrderVo(OrderDo od, OrderExtraDo oed);

    List<OrderVo.Order> toOrderVoList$Order(List<OrderDo> subOrderList);

    OrderExcelVo toOrderExcelVo(OrderDo od, OrderExtraDo oed);
}
